// pages/sharebox/newuserxiche/newuserxiche.js
import {
  newUserSubmit
} from '../../../utils/networkRequest.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    guize: "",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

    // options.ppid =1;
    // options.guize="12123123"
    if (options.ppid)
      this.setData({
        guize: options.guize,
        ppid:options.ppid,
      })
  },
  getPhone: function(e) {
    this.setData({
      phone: e.detail.value
    })
  },
  sendPhone: function() {
    let self =this;
    newUserSubmit(this.data.phone,(r)=>{
      if(r.code == 0){
       wx.redirectTo({
         url: '../xiche/xiche?ppid=' + self.data.ppid,
       })
      }else{
        wx.showToast({
          icon:"none",
          title: r.message,
        })
      }
    })
  }
})